﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace Kea
{
    internal class LinkedFilter<T>
    {
        private Func<T, bool> _filter;
        private LinkedFilter<T> _previous;
        public LinkedFilter(Func<T, bool> filter, LinkedFilter<T> previous)
        {
            _filter = filter;
            _previous = previous;
        }
        public bool Where(T t)
        {
            return (_previous != null && !_previous.Where(t)) ? false : _filter(t);
        }
    }
}
